<template>
	<view class="money-show" :style="{
		color: color
	}">
		<template v-if="z != 0">
			<text style="padding-right: 3px;">{{ z }}</text>
			<image src="https://crazy3.top/jx3/images/icon/金砖.gif" style="width: 10px;padding: 0 1px;" mode="widthFix"></image>
		</template>
		<text style="padding: 0 3px;">{{ j }}</text>
		<image src="https://crazy3.top/jx3/images/icon/元宝.png" style="width: 12px;padding-left: 1px;" mode="widthFix"></image>
	</view>
</template>

<script>
	import { jinBL } from '../../utils/const.js'
	export default {
		name:"gold",
		data() {
			return {
				z: 0,
				j: 0,
			};
		},
		props: {
			money: {
				default: 0,
				type: [String, Number]
			},
			color: {
				default: '#fe9a5e',
				type: String
			}
		},
		watch: {
			money(newVal) {
				this.z = Math.floor((newVal * jinBL) / 10000)
				this.j = ((newVal * jinBL) % 10000).toFixed(0)
			}
		},
		mounted() {
			this.z = Math.floor((this.money * jinBL) / 10000)
			this.j = ((this.money * jinBL) % 10000).toFixed(0)
		},
	}
</script>

<style lang="scss" scoped>
	.money-show {
		display: inline-block;
		font-weight: bold;
		width: fit-content;
	}
</style>